#pragma once 
#include <iostream>
#include <string>
#include <jsoncpp/json/json.h>
namespace ns_response
{
    struct Response
    {
        int status = 0;
        std::string reason;
        std::string stdout;
        std::string stderr;
        std::string stdinput;


        std::string Serialize()
        {
            Json::Value root;
            root["status"] = status;
            root["reason"] = reason;
            root["stdout"] = stdout;
            root["stderr"] = stderr;
            root["stdinput"] = stdinput;
            Json::FastWriter fwriter;
            return fwriter.write(root);
        }
        void DeSerialize(const std::string& in)
        {
            Json::Value droot;
            Json::Reader reader;
            reader.parse(in, droot);
            reason = droot["reason"].asString();
            stdout = droot["stdout"].asString();
            stderr = droot["stderr"].asString();
            stdinput = droot["stdinput"].asString();
        }
    };
}